package com.example.plan.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.plan.common.result.Result;
import com.example.plan.entity.Drone;
import com.example.plan.model.dto.arNavigation.ArNavigationDTO;
import com.example.plan.model.dto.arNavigation.ArNavigationPageDTO;
import com.example.plan.model.dto.drone.DroneDTO;
import com.example.plan.model.dto.drone.DronePageDTO;
import com.example.plan.model.vo.ArNavigationVO;
import com.example.plan.model.vo.DroneVO;
import com.example.plan.service.ArNavigationService;
import com.example.plan.service.DroneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

@Data
@Slf4j
@Api(tags = "无人机设备模块")
@RestController
@RequestMapping("drone")
public class DroneController {
    private final DroneService droneService;

    @ApiOperation(value = "新增无人机设备")
    @PostMapping("/saveDrone")
    public Result<Void> saveDrone(@RequestBody @Validated DroneDTO dto) {
        return droneService.saveDrone(dto);
    }
    @ApiOperation(value = "删除无人机设备")
    @GetMapping("/deleteDrone/{droneId}")
    public Result<Void> deleteDrone(@PathVariable @NotNull Long droneId) {
        return droneService.deleteDrone(droneId);
    }
    @ApiOperation(value = "查询无人机设备详情")
    @GetMapping("/getDrone/{droneId}")
    public Result<DroneVO> getDrone(@PathVariable @NotNull Long droneId) {
        return droneService.getDrone(droneId);
    }
    @ApiOperation(value = "分页带条件查询无人机设备")
    @PostMapping("/pageDrone")
    public Result<IPage<DroneVO>> pageDrone(@RequestBody @Validated DronePageDTO dto) {
        return droneService.pageDrone(dto);
    }

    @ApiOperation(value = "修改无人机设备")
    @PostMapping("/updateDrone")
    public Result<Void> updateDrone(@RequestBody @Validated DroneDTO dto) {
        return droneService.updateDrone(dto);
    }
}
